package com.szsh.aiot.hsm.enums;

import com.szsh.aiot.common.utils.StringUtils;

/**
 * 流量告警表
 * deviceType
 */
public enum DeviceType {

    OTHER(0, "其他设备"),
    CAMERA(1, "摄像头设备"),
    VOICEBOX(2, "音箱");

    private final int val;
    private final String desc;

    DeviceType(int val, String desc) {
        this.val = val;
        this.desc = desc;
    }

    public int getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    public static int getDeviceType(String name) {
        if (StringUtils.isBlank(name)) {
            return DeviceType.OTHER.getVal();
        }
        if (name.contains("摄像")) {
            return DeviceType.CAMERA.getVal();
        } else if (name.contains("音箱")) {
            return DeviceType.VOICEBOX.getVal();
        } else {
            return DeviceType.OTHER.getVal();
        }
    }
}
